<!--继承基文件-->
{% extends "base.html" %}
{% load static %}
<!--标题-->
{% block title %} 添加用户 {% endblock title %}
{% block user %}{% if request.session.user %}{{ request.session.user }}{% else %} administrator{% endif %}{% endblock %}

<!--内容-->
{% block content %}
    <div class="right-product my-index right-full">
        <div class="container-fluid">
            <div class="info-center">
                {% include 'content_head.html' %}

                <div class="content-list">
                    <div class="row newslist" style="margin-top:20px;">
                        <div class="col-md-12">
                            <div class="panel panel-info mystyle-panel">
                                <div class="panel-heading">
                                    添加用户
                                    <div class="caret"></div>
                                    <a href="#" class="pull-right"><span class="glyphicon glyphicon-refresh"></span></a>
                                </div>
                                <div class="panel-body">
                                    <form class="form-horizontal" id="addUser" action="" method="post"
                                          onsubmit="return adduser_check();">
                                        {% csrf_token %}
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label for="username" class="col-sm-2 control-label">
                                                <span class="myRed">* </span>用户名</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control myInput" id="username"
                                                       placeholder="请输入用户名"
                                                       name="username">
                                                <span class="myGray">必须为4-16位字母、数字或下划线，且以字母开头</span>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label for="password" class="col-sm-2 control-label">
                                                <span class="myRed">* </span>密码</label>
                                            <div class="col-sm-10">
                                                <input type="password" class="form-control myInput" id="password"
                                                       placeholder="请输入密码"
                                                       name="password">
                                                <span class="myGray">密码必须为6-16位数字、英文字母或下划线</span>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label class="col-sm-2 control-label">性别</label>
                                            <div class="col-sm-10">
                                                <label class="radio-inline">
                                                    <input type="radio" name="gender" value="0" checked> 男
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="gender" value="1"> 女
                                                </label>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label for="age" class="col-sm-2 control-label">年龄</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control myInput" id="age"
                                                       placeholder="请输入年龄" name="age">
                                                <span class="myGray">请输入两位整数</span>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label for="email" class="col-sm-2 control-label">邮箱</label>
                                            <div class="col-sm-10">
                                                <input type="email" class="form-control myInput" id="email"
                                                       placeholder="请输入邮箱"
                                                       name="email">
                                                <span class="myGray">请输入正确的邮箱地址</span>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label for="phone" class="col-sm-2 control-label">手机号</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control myInput" id="phone"
                                                       placeholder="请输入手机号"
                                                       name="phone">
                                                <span class="myGray">请输入手机号</span>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <label class="col-sm-2 control-label">用户类型</label>
                                            <div class="col-sm-10">
                                                <label class="radio-inline">
                                                    <input type="radio" name="userType" value="general" checked> 普通用户
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="userType" value="admin"> 管理员
                                                </label>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <span style="color:red;">{{ error }}</span>
                                            </div>
                                        </div>
                                        <div class="form-group" style="margin-top: 10px;">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <input type="submit" class="btn btn-primary myInput" value="添加">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock content %}

<!--js文件-->
{% block jsFiles %}
    <script src="{% static 'js/myAddUser.js' %}"></script>
{% endblock jsFiles %}